home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
keyb
/
fastbf26.zip
/
FASTBF26.ASM
next >
Wrap
Assembly Source File
|
1989-08-14
|
44KB
|
1,648 lines
PAGE ,132
; FASTBUFF.ASM - Keyboard buffer resident utility.
; Version 2.6
; by: David Steiner
; [D.STEINER] on GEnie
; 2035 J Apt. 6
; Lincoln, NE 68510
; (402) 475-0601
; This is a fairly big update from version 1.0. FASTBUFF now
; handles Alt-keypad character entries correctly, plus fixes
; these characters since many IBM clones generate incorrectly.
; The way characters are restored to the system has been updated
; also. We no longer hook the Keyboard I/O interrupt, instead we
; continuously keep the BIOS buffer full by filling it every time
; the system timer clicks (Interrupt 1C).
; This was done as an allowance for programs that bypass the BIOS
; when doing character I/O. It has the added benefit of allowing
; FASTBUFF to be active when installed after other utilities that
; hook into interrupt 16.
; The only software compatibility problems that should arise will
; be with other programs that hook the Keystroke interrupt and attempt
; to insert characters directly into the BIOS keyboard buffer.
; "Key-fake" utilities are an example of such programs. If you
; need to use such a program, it is best to deactivate FASTBUFF first.
;v2.6 Toad Hall, 14 Aug 89
; - Bug: When setting many many cmdline switches (example:
; FASTBUFF /V0 /B50 /D9 /S
; program reports an error with the last switch/parameter.
; Checking out cmdline parsing.
; Thanks to Keith Petersen's son for reporting this one!
; - Bug in cmdline parsing .. we were not correctly AsciiZing the last parm
; (skipped an essential loop!).
; - Bug in SetDelay: checking for illegal high value, the 'jz' branch
; should've been 'jnz' .. dumb!
; - Removing old 'v2.5' comments.
;v2.5 Toad Hall tweak, 1 May 89
; - Removing old "v2.n" comments.
; - Changed default screen blanking to 6 minutes.
; - Using one beep for ACK or on, two beeps for off.
; Rewrote the beep code because of an irritating click and delay
; on my system. Sound is now 8253 timer-driven.
; Frequency is arbitrary.
; Could be this will break any programs doing simultaneous music/sound
; (or other timer-driven activities) and keyboard activity ..
; but then we don't beep THAT often!
;v2.4 Toad Hall Debug, Tweak, 2 Apr 89
; - Added new command line parameter processing.
; - Fixed possible bug in '/v' video blanking delay.
; - Tightened up, debugged GetNum procedure for cmdline numeric values.
; - Adding explanatory error msgs for faulty command line parameters.
; - Left the rest alone for now.
; - Per Keith Petersen's suggestion, adding forced screen blanking
; ([5][End]).
; - Also added a screen blanking toggle ([5][HOME].
; Overrides the commandline '/V' or '-V0' (whichever) (if any).
; - Tightened up Command key processing a little (sharing common code).
; - Added a real short beep to acknowledge [5] commands.
; - Single short beep means "ON", extra-long beep means "OFF".
; - Considering a pop-up window with function-key or cursor-key
; variable settings (rather than the somewhat cryptic [5][whatever]
; combos we're using now). That would add a lot of code, though,
; plus storage space for user's screen, etc. Maybe later.
; - No problem with switching from Int 1CH to Int 8 .. I was tempted
; to do the same myself, but wanted to keep this "well-behaved".
; - Removed code commented out by v2.2, v2.3.
;v2.3 Dave, March 15, 1989
; - Changed timer interrupt vector from 1C to 8.
; This fixes problems with programs that incorrectly hook the
; software timer interrupt (1C). IBM BASIC is one such program.
;v2.2 Toad Hall Tweak, 2 Mar 89
; - Keith Petersen detected DSZ serial port errors when FASTBUFF was
; installed and DSZ was running at VERY high (19200 baud) rates.
; Suspect we're grabbing interrupts too often or too long.
; Tweaking to reduce CLI periods and ANY other delays.
; - Removed a bunch of v2.0 code I'd commented out in v2.1
; (since v2.1 seems to be working all right).
;v2.1 Toad Hall Tweak, 23 Feb 89
; - General tightening
; - Much more use of AX vs. other regs
; - Described a Page40 segment to permit faster BIOS variable
; addressing.
; - Now using DS: instead of ES: to address BIOS variables.
; - FATAL error when new interrupt svcs call or jump to the old
; interrupt vectors! Author didn't address the saved vector
; (oldint9, etc.) as CS:.
; - Tightened up installation procedure:
; - Uses runtime variables rather than installation variables.
; - If error, terminates with proper Svc 4CH, Int 21H.
; - Now freeing environment variable before going TSR
; - Rounding up TSR program/data size to nearest paragraph
; before going TSR.
; - Reduced .COM file about 1Kb. Runtime memory requirements:
; - v2.0 1504 bytes, 2 blocks
; - v2.1 1296 bytes, 1 block
; .. not too shabby.
; Kudos to the author .. nice logic.
; David Kirschbaum
; Toad Hall
; kirsch@braggvax.ARPA
;------ EQUATES
CR equ 0DH
LF equ 0AH
TIMER equ 40H ;timer chip
PORT_B equ 61H ;8253 port B
HIFREQ equ 300 ;high freq for on
LOFREQ EQU 900 ;200 ;low freq for off
ERRFREQ equ 350 ;keyboard overrun beep
;------ BIOS buffer & otherstuff equates
Page40 segment at 40H
org 10H
biosequipflags dw ? ;410H BIOS equipment word address
org 17H
;------ BIOS shift status byte 1 & masks for action key combinations
biosshflags db ? ;417H First BIOS shift status byte
db ?
CLRMASK equ 05H ; Clear buffer key mask
biosaltbuff db ? ;419H Storage for Alt-keypad entries
bioshead dw ? ;41AH BIOS keyboard buffer head
biostail dw ? ;41CH "" tail
biosbuffer db ? ;41EH BIOS keyboard buffer start
org 3EH
biosendbuff label byte ;43EH end
org 65H
bioscrtmodeset db ? ;465H
biospalette db ? ;466H
EQUIPMASK equ 0010H
PALETTEMASK equ 0FH
org 71H
;------ BIOS break detection byte
biosbreak db ? ;471H Bit 7 of this byte indicates
BREAKMASK equ 80H ; ctrl-break was pressed
Page40 ENDS
KBINPORT equ 60H ; Keyboard data port
;KBCTRLPORT equ 61H ; Keyboard control port
ALTSHIFT equ 38H ; ALT key scan code
;------ FASTBUFF control key scan codes
FBCTRLKEY equ 4CH ; Scan code for "5" on keypad
FBONKEY equ 52H ; Code for INS key
FBOFFKEY equ 53H ; Code for DEL key
FBFAST equ 4EH ; Code for keypad "+"
FASTREP equ 2 ; Chars per click for fast rate
FBSLOW equ 4AH ; Code for keypad "-"
SLOWREP equ 1 ; Chars per click for slow rate
FBENDKEY equ 4FH ; Code for END key
FBHOMEKEY equ 47H ; Code for HOME key
;------ Masks for altering bits in our status byte.
FBMASK equ 01H ; Masks for FASTBUFF toggle
REPMASK equ 02H ; On when we need to repeat a character
SCRMASK equ 04H ; On while screen is active
CTRLMASK equ 08H ; On when [5] is being held down
OLDINT9MASK equ 10H ; On when processing char with old int9
VIDMASK equ 20H ; Video blanking active?
BLANKMASK equ 40H ; Forced video blanking?
CSEG segment public para 'CODE'
ASSUME CS:CSEG, DS:CSEG
org 2CH
env_adr dw ? ;environment segment
org 80H
nchar db ? ;PSP cmdline char count
params db ? ;PSP cmdline chars
org 100H
Start:
jmp Initialize
;------ Old vector storage area
oldint9 dw 0,0
oldint10 dw 0,0
oldint8 dw 0,0
;--------------------------------------------------------------------------
;Resident data area
;--------------------------------------------------------------------------
lastchar dw 0FFFFH ; Last character typed, undef at start
repcount db ? ; # ticks till next repeat
repchars db 2 ; Default # chars to repeat
; per click
; Keith Petersen suggested increasing this start delay a little
; (because of repeated Return keys, fast cursor keys, etc.).
; Changing from the original 5 to 7 ticks delay.
startdelay db 7 ; Delay before repeating new char
; 6-minute screen blanking timeout default.
BLANKTIME EQU (6 * 1092) ;6 minutes * 1092 ticks per min
scrcount dw BLANKTIME ; Time left till screen blanked
screendelay dw BLANKTIME ; "Constant" for refreshing
; scrcount
switches db SCRMASK AND VIDMASK ; FASTBUFF off, screen active,
; default screen bl